package main

import (
	"fmt"
	"github.com/andygrunwald/go-trending"
)

func main() {
	trend := trending.NewTrending()

	// Show projects of today
	projects, _ := trend.GetProjects(trending.TimeToday, "python")
	// if err != nil {
	// 	println(err)
	// 	panic(err)
	// }

	for index, project := range projects {
		i := index + 1
		if len(project.Language) > 0 {
			fmt.Printf("%d: %s (written in %s with %d ★ )\n", i, project.Name, project.Language, project.Stars)
			fmt.Printf("描述：%s \n", project.Description)
		} else {
			fmt.Printf("%d: %s (with %d ★ )\n", i, project.Name, project.Stars)
		}

		println("https://" + project.URL.Host + project.URL.Path)
	}
}
